﻿@{
    ViewBag.Title = "产品列表";
    Layout = "~/Areas/Shared/_spListV1.cshtml";
    ViewBag.ListActionURL = Url.Action("LinkList", "LinkManage", new { area = "Admin" });
    ViewBag.AddActionURL = Url.Action("AddLink", "LinkManage", new { area = "Admin" });
    ViewBag.DelActionURL = Url.Action("DelLink", "LinkManage", new { area = "Admin" });
    ViewBag.EditActionURL = Url.Action("EditLink", "LinkManage", new { area = "Admin" });
    ViewBag.IdColumn = "ProductId";
    ViewBag.NameColumn = "ProductName";
    ViewBag.ListSortName = "";
    ViewBag.ListSortOrder = "";
    ViewBag.AddWindowTitle = "添加友情连接";
    ViewBag.EditWindowTitle = "编辑友情连接";   
}
@model Kaiser.Modules.Hiner.Models.Product.ProductBase
@section Script
{
    <script type="text/javascript">

        config.GridOption.toolbar = "#tb";
        config.GridOption.columns = [[
            { field: 'ProductName', title: 'Item', width: 40, sortable: true },
            {
                field: 'ProductHDECode',
                title: 'HDE Code',
                width: 50,
                sortable: true,
                formatter: function (value, row, index) {
                    var html = "<a id='ViewProduct' href='#'>" + value + "</a>";
                    return html;
                }
            },
            { field: 'ProductHinerCode', title: 'HINER Code', width: 50, sortable: true, formatter: function (value, row, index) {
                var html = "<a id='ViewProduct' href='#'>" + value + "</a>";
                return html;
            }
            },
            { field: 'ProductOERef', title: 'OE Ref.', width: 80, sortable: true }
        ]];




        config.GridOption.onClickCell = function (rowIndex, field, value) {

            var data = $('#grid').datagrid('getData');

            if (field == 'ProductHDECode' || field == 'ProductHinerCode') {
                dialog = parent.openWindow({
                    title: "产品详细",
                    url: '@Url.Action("ProductDetail")?id=' + data.rows[rowIndex].ProductId,
                    height: 600,
                    width: 800,
                    isIframe: true,
                    maximizable: true,
                    toolbar: [

                        {
                            text: '关闭',
                            iconCls: "icon-no",
                            handler: function () {
                                dialog.dialog("close");
                            }
                        }
                    ]
                });


            }
        };



 
    </script>
}
<div id="tb" style="padding: 5px; height: auto">
    <div style="margin-bottom: 5px">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true">新增</a>
                </td>
                <td>
                    <div class="datagrid-btn-separator">
                    </div>
                </td>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true">修改</a>
                </td>
                <td>
                    <div class="datagrid-btn-separator">
                    </div>
                </td>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true">删除</a>
                </td>
            </tr>
        </table>
    </div>
    <div style="margin-bottom: 5px">
        <form method="post" id="QuickSearch" class="quickSearch">
        <table>
            <tr>
                <td>
                    HDE Code： @Html.TextBox("ProductHDECode")
                </td>
                <td>
                    Hiner Code： @Html.TextBox("ProductHinerCode", "")
                </td>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="Search()">查询</a>
                </td>
            </tr>
        </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    function Search() {

        var sf = $("#QuickSearch").serializeJson();
        //alert(sf);
        grid.datagrid({ url: virpath + config.ListActionURL, queryParams: sf });
    }
    $("#QuickSearch input").keyup(function (event) {
        if (event.keyCode == 13) Search();
    });
</script>
